namespace SimulationPathViewer
{
    public partial class MainForm
    {
        private void openDXFToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Filter = "DXF files (*.dxf)|*.dxf|All files (*.*)|*.*";
                openFileDialog.FilterIndex = 1;

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        var points = DxfPathExtractor.ExtractPathFromDxf(openFileDialog.FileName);
                        LoadPathPoints(points);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show($"Error loading DXF file: {ex.Message}", "Error", 
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
    }
}
